package com.cy.sys.log.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.cy.sys.log.page.vo.JSONResult;
import com.cy.sys.log.service.SysDeptSerivce;
import com.cy.sys.pojo.SysDepts;

@RestController
@RequestMapping("/dept/")
public class sysDeptcontorller {
	@Autowired
	private SysDeptSerivce sysdeptdao;
	
	@RequestMapping("doFindObjects")
	public JSONResult doFindObjects() {
		return new JSONResult(sysdeptdao.findAllDepts());
	}
	
	//树结构查询
		@RequestMapping("doFindZTreeNodes")
		public JSONResult doFindZTreeNodes() {
			return new JSONResult(sysdeptdao.selectfindzTee());	
		}
	//新增	
		@RequestMapping("doSaveObject")
		public JSONResult doFindObjects(SysDepts sysdepts) {
			return new JSONResult(sysdeptdao.insertDept(sysdepts));
		}	
	//修改
		@RequestMapping("doUpdateObject")
		public JSONResult dosaveObject(SysDepts sysdepts) {
			sysdeptdao.updateDeptById(sysdepts);
			return new JSONResult("update ok");
		}
}
